export namespace Downloader {
  export interface FromUrlOptions {
    url: string;
    fileName: string;
  }
  export function fromUrl(opts: FromUrlOptions) {
    const link = document.createElement('a');
    link.style.display = 'none'
    link.href = opts.url;
    link.setAttribute('download', opts.fileName);
    link.setAttribute('target', '_blank')
    document.body.appendChild(link);
    link.click();
    document.body.removeChild(link);
  }
  export interface FromBlobOptions {
    blob: Blob;
    fileName: string;
  }
  export function fromBlob(opts: FromBlobOptions) {
    const url = window.URL.createObjectURL(opts.blob)
    fromUrl({ url, fileName: opts.fileName })
    window.URL.revokeObjectURL(url)
  }
}